package com.example.myapplication;

import android.content.Intent;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.example.fragment.FragmentPaperInfo;
import com.example.fragment.FragmentStudentInfo;
import com.example.fragment.FragmentTeacherInfo;
import com.example.fragment.FragmentWorkInfo;

public class TeacherInfoActivity extends AppCompatActivity {

    private FragmentTeacherInfo fragmentStudentInfo;
    private FragmentWorkInfo fragmentPaperInfo;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_user_info);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent();
                intent.setClass(TeacherInfoActivity.this, WorkinfoActivity.class);
                startActivity(intent);
            }
        });
        Bundle bundle = getIntent().getExtras();
        fragmentStudentInfo = new FragmentTeacherInfo();
        fragmentStudentInfo.setArguments(bundle);
        fragmentPaperInfo = new FragmentWorkInfo();
        fragmentPaperInfo.setArguments(bundle);
        FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
        fragmentTransaction.add(R.id.user_imagelayout,fragmentStudentInfo);
        fragmentTransaction.add(R.id.list,fragmentPaperInfo);
        fragmentTransaction.show(fragmentPaperInfo);
        fragmentTransaction.show(fragmentStudentInfo);
        fragmentTransaction.commit();

    }
}
